<template>
<!-- 渲染路由组件 -->
<el-config-provider :locale="zhCn">

     <router-view #default="{Component}" :key="keys">
          <Suspense @resolve="resolve"> 
                     <template #default>
                   
                         <component :is="Component"/>
                     </template>   
          </Suspense>
          </router-view>

</el-config-provider>
</template>

<script setup lang="ts">
import { ElLoading } from "element-plus";
import zhCn from "element-plus/lib/locale/lang/zh-cn"
import { computed } from "vue";
import {useRoute} from "vue-router"

const loadingInstance =ElLoading.service({
      background:"rgba(255,255,255,.5)",
      text:'加载中...'
})


const keys=computed<string>(()=>{
      // console.log("被执行....");
      
 return useRoute().name?useRoute().name as any + new Date():useRoute() as any +new Date()
})
const resolve =()=>{
 
      loadingInstance.close()
    
}




</script>

<style scoped>
 


</style>